﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TapTapServer
{
    public class Settings
    {

        static Settings instance = null;
        static readonly object padlock = new object();

        Settings() { }

        public static Settings Instance
        {
            get
            {
                lock (padlock)
                {
                    if (instance == null)
                    {
                        instance = new Settings();
                    }
                    return instance;
                }
            }
        }

        private bool pathSet;
        public bool ServerPathSet
        {
            get { return pathSet; }
        }

        private string serverRootPath;
        public string ServerRootPath
        {
            get { return serverRootPath; }
            set { serverRootPath = value; pathSet = true; }
        }

        public string ThemePath
        {
            get { return System.IO.Path.Combine(serverRootPath, "cdn\\themes"); }
        }
        public string TracksPath
        {
            get { return System.IO.Path.Combine(serverRootPath, "cdn\\tracks"); }
        }
        public string TemplatesPath
        {
            get { return System.IO.Path.Combine(serverRootPath, "templates"); }
        }

        public static Uri ContentAddress
        {
            get { return new Uri("http://pub.tapulous.com/cdn/"); }
        }
        public static Uri ThemesAddress
        {
            get { return (new Uri(ContentAddress, "themes/")); }
        }
        public static Uri TracksAddress
        {
            get { return (new Uri(ContentAddress, "tracks/")); }
        }
    }

}